#pragma once
#include "OCMain/Log.h"
#include "OCMain/FileUtil.h"
#include "OCMain/Date.h"
#include "OCServer/ServerUtil.h"
#include "OCMain/zip/BZip2.h"
#include "OCMain/ZipUtil.h"
#include "OCMain/Singleton.h"
#include "sqlpp11/sqlite3/connection.h"

using namespace OCPP;

class MyDatabase
{
public:
	String create(String fileName);
	String open(String fileName);
	void close();
	String getProjectData(String project, String projectType);
	bool insert(String pid, String time, double x, double y, double z, String project, String projectType, String desc);
	
	String listGeoObserveTime();
	bool insertGeoObserve( String time, String desc);
	String getGeoObserveData(String time);
	bool update(String pid, String time, double x, double y, double z, String project, String projectType, String desc);
	bool deleteADay(String time, String project, String projectType);

	String insertProject(String project, String desc);
	String updateProject(String project, String desc);
	String listProject();
	String listTime();
	String listProjectInTime(String time);
	bool existProject(String name);
	std::shared_ptr<sqlpp::sqlite3::connection> connection;
private:
	CORE_AUTO_MUTEX;
};
